<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<h:panelGrid id="promotionLocationInputPanel" columns="1"
		style="width:100%">
		<p:dataTable var="location"
			value="#{promotionModel.current.locations}" rows="20">
			<f:facet name="header">
				<p:commandButton oncomplete="locationDlg.show()" ajax="true"
					update=":dialogForm,:headerForm" icon="add"
					actionListener="#{locationController.init}" value="Add"
					title="Add location" style="float:left"></p:commandButton>Locations</f:facet>
			<p:column style="width:20px">
				<p:commandButton icon="delete" ajax="true" update=":detailForm"
					style="float:right"
					actionListener="#{promotionController.removeLocationFromCurrent}">
					<f:setPropertyActionListener value="#{location}"
						target="#{promotionController.removeLocationFromCurrent}" />
				</p:commandButton>
			</p:column>
			<p:column headerText="id">
				<h:outputText value="#{location.id}" />
			</p:column>
			<p:column headerText="name" sortBy="#{location.name}">
				<h:outputText value="#{location.name}" />
			</p:column>
			<p:column headerText="district" sortBy="#{location.district}">
				<h:outputText value="#{location.district}" />
			</p:column>
			<p:column headerText="address" sortBy="#{location.address}">
				<h:outputText value="#{location.address}" />
			</p:column>
		</p:dataTable>
	</h:panelGrid>
</ui:composition>

</html>